<%@ page language="java" pageEncoding="UTF-8" %>

<script>
    var _debug = false;
    var _con_press_times = 0;
    var _con_press_trigger_times = 3;
    //进入debug模式
    $(document).on("keyup", "html", function (e) {
    // console.log(e.which);
    // console.log($(this));
    //连按alt+ctrl+` 3次触发debug模式
        if (!(e.which == 192 && e.ctrlKey && e.altKey)) {
            _con_press_times = 0;
            return;
        }

        var tagName = e.target.tagName.toLowerCase();
        if (tagName != 'body') {
            _con_press_times = 0;
            return;
        }

        _con_press_times++;

        var href = window.location.href;
        if (href.indexOf("_debug") < 0 && _con_press_times >= _con_press_trigger_times) {
            window.location.href = window.location.href + "&_debug";
        } else {
            console.log("cur times:" + _con_press_times + "/" + _con_press_trigger_times);
        }
    });
</script>

<%
    String debug = request.getParameter("_debug");
    if (debug != null) {
%>
<script>
    _debug = true;
    console.log('[mode]Debug enabled...');

</script>
<%
    }
%>
<script>
    if (!_debug) {
        console.warn('[warn]当前没有开启debug模式，所有console.log打印将被忽略');
        console.warn('[warn]请加上参数 &_debug 到url末尾，然后刷新');
        window.console.log = function (msg) {
        }
    }
</script>